<?php
class Frontend_Form_Query_Submit extends Zend_Form
{
    public function init()
    {
        $translator = self::$_translatorDefault;

         $this->addElement('hidden', 'category_id', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'decorators' => array('viewHelper',array('HtmlTag', array('tag' => 'div', 'class' => 'ndsp')))
        ));

        $this->addElement('text','title',array(
            'filters'       => array('StringTrim','StringToLower'),
            'validators'    => array(
                array('StringLength',true,array(3,100))
            ),
            'required'      => true,
            'label'         => $translator->translate('question title')
        ));

        $this->addElement('textarea','content',array(
            'filters'       => array('StringTrim'),
            'validators'    => array(array('StringLength',true,array(5,9999))),
            'attribs'       => array('style'=>'width:450px;height:200px;'),
            'required'      => true,
            'label'         => $translator->translate('question addition'),
        ));

        $arr = Wenda::getModel('Category')->getRoot();
        $cats = array();
        foreach ($arr as $row){
            $cats[$row['id']] = $row['title'];
        }

        $this->addElement('select', 'category', array(
            'multiOptions'  => $cats,
            'attribs'       => array('size'=>15),
            'required'      => true,
            'label'         => $translator->translate('question category'),
        ));

        $this->addElement('select', 'subcategory', array(
            'attribs'       => array(
                'size'=>15,
                'style'=>'width:200px;'
            ),
            'registerInArrayValidator'  => false
        ));

        $rewards = array(
            '0'     => '0',
            '5'     => '5',
            '10'    => '10',
            '20'    => '20',
            '30'    => '30',
            '50'    => '50',
            '80'    => '80',
            '100'   => '100'
        );
        $this->addElement('select','reward',array(
            'multiOptions'  => $rewards,
            'label'         => $translator->translate('question reward'),
        ));

        $this->addElement('submit','submit',array(
            'label'         => $translator->translate('submit'),
        ));

    }
}
